package com.doctcloud.datacloud.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.annotation.Excel;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

import static com.doctcloud.common.core.utils.StringUtils.trim;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode(of = {"itemClass","itemCode","itemSpec","units","startDate"})
@TableName("transfer")
public class TransferEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Excel(name = "患者ID")
    private String patientId;
    @Excel(name = "住院标识")
    private Integer visitId;
    @Excel(name = "所在科室")
    private String deptStayed;
    @Excel(name = "入科时间")
    private Date admissionDateTime;
    @Excel(name = "出科时间")
    private Date dischargeDateTime;
    @Excel(name = "转向科室")
    private String deptTransferedTo;
    @Excel(name = "经治医师")
    private String doctorInCharge;

    @Data
    public static class Key {
        private final String patientId;
        private final Integer visitId;
        private final Date admissionDateTime;

        public Key(String patientId, Integer visitId, Date admissionDateTime) {
            this.patientId = patientId;
            this.visitId = visitId;
            this.admissionDateTime = admissionDateTime;
        }
    }

    public void setDoctorInCharge(String doctorInCharge) {
        this.doctorInCharge = trim(doctorInCharge);
    }
}
